﻿package idv.cjcat.shintaz.compiler.scanner {

	public class Pattern {
		
		private static var _code:int;
		
		/**
		 * /\s/
		 * @param	char
		 * @return
		 */
		public static function isWhiteSpace(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.SPACE: case CharCode.TAB: case CharCode.RETURN: case CharCode.N_LINE:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/**
		 * /[a-zA-Z]/
		 * @param	char
		 * @return
		 */
		public static function isAlphabet(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.LOWER_A: case CharCode.LOWER_B: case CharCode.LOWER_C: case CharCode.LOWER_D: case CharCode.LOWER_E: case CharCode.LOWER_F: case CharCode.LOWER_G: case CharCode.LOWER_H: case CharCode.LOWER_I: case CharCode.LOWER_J: case CharCode.LOWER_K: case CharCode.LOWER_L: case CharCode.LOWER_M: case CharCode.LOWER_N: case CharCode.LOWER_O: case CharCode.LOWER_P: case CharCode.LOWER_Q: case CharCode.LOWER_R: case CharCode.LOWER_S: case CharCode.LOWER_T: case CharCode.LOWER_U: case CharCode.LOWER_V: case CharCode.LOWER_W: case CharCode.LOWER_X: case CharCode.LOWER_Y: case CharCode.LOWER_Z: case CharCode.UPPER_A: case CharCode.UPPER_B: case CharCode.UPPER_C: case CharCode.UPPER_D: case CharCode.UPPER_E: case CharCode.UPPER_F: case CharCode.UPPER_G: case CharCode.UPPER_H: case CharCode.UPPER_I: case CharCode.UPPER_J: case CharCode.UPPER_K: case CharCode.UPPER_L: case CharCode.UPPER_M: case CharCode.UPPER_N: case CharCode.UPPER_O: case CharCode.UPPER_P: case CharCode.UPPER_Q: case CharCode.UPPER_R: case CharCode.UPPER_S: case CharCode.UPPER_T: case CharCode.UPPER_U: case CharCode.UPPER_V: case CharCode.UPPER_W: case CharCode.UPPER_X: case CharCode.UPPER_Y: case CharCode.UPPER_Z:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/**
		 * /[0-9]/
		 * @param	char
		 * @return
		 */
		public static function isNumber(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.NUM_0: case CharCode.NUM_1: case CharCode.NUM_2: case CharCode.NUM_3: case CharCode.NUM_4: case CharCode.NUM_5: case CharCode.NUM_6: case CharCode.NUM_7: case CharCode.NUM_8: case CharCode.NUM_9:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/**
		 * /[0-9a-eA-E]/
		 * @param	char
		 * @return
		 */
		public static function isHex(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.LOWER_A: case CharCode.LOWER_B: case CharCode.LOWER_C: case CharCode.LOWER_D: case CharCode.LOWER_E: case CharCode.LOWER_F: case CharCode.UPPER_A: case CharCode.UPPER_B: case CharCode.UPPER_C: case CharCode.UPPER_D: case CharCode.UPPER_E: case CharCode.UPPER_F: case CharCode.NUM_0: case CharCode.NUM_1: case CharCode.NUM_2: case CharCode.NUM_3: case CharCode.NUM_4: case CharCode.NUM_5: case CharCode.NUM_6: case CharCode.NUM_7: case CharCode.NUM_8: case CharCode.NUM_9:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/**
		 * /[$$a-zA-Z_]/
		 * @param	char
		 * @return
		 */
		public static function isIdentifierHead(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.U_LINE: case CharCode.MONEY: case CharCode.LOWER_A: case CharCode.LOWER_B: case CharCode.LOWER_C: case CharCode.LOWER_D: case CharCode.LOWER_E: case CharCode.LOWER_F: case CharCode.LOWER_G: case CharCode.LOWER_H: case CharCode.LOWER_I: case CharCode.LOWER_J: case CharCode.LOWER_K: case CharCode.LOWER_L: case CharCode.LOWER_M: case CharCode.LOWER_N: case CharCode.LOWER_O: case CharCode.LOWER_P: case CharCode.LOWER_Q: case CharCode.LOWER_R: case CharCode.LOWER_S: case CharCode.LOWER_T: case CharCode.LOWER_U: case CharCode.LOWER_V: case CharCode.LOWER_W: case CharCode.LOWER_X: case CharCode.LOWER_Y: case CharCode.LOWER_Z: case CharCode.UPPER_A: case CharCode.UPPER_B: case CharCode.UPPER_C: case CharCode.UPPER_D: case CharCode.UPPER_E: case CharCode.UPPER_F: case CharCode.UPPER_G: case CharCode.UPPER_H: case CharCode.UPPER_I: case CharCode.UPPER_J: case CharCode.UPPER_K: case CharCode.UPPER_L: case CharCode.UPPER_M: case CharCode.UPPER_N: case CharCode.UPPER_O: case CharCode.UPPER_P: case CharCode.UPPER_Q: case CharCode.UPPER_R: case CharCode.UPPER_S: case CharCode.UPPER_T: case CharCode.UPPER_U: case CharCode.UPPER_V: case CharCode.UPPER_W: case CharCode.UPPER_X: case CharCode.UPPER_Y: case CharCode.UPPER_Z:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/**
		 * /[$$0-9a-zA-Z_]/
		 * @param	char
		 * @return
		 */
		public static function isIdentifierBody(char:String):Boolean {
			switch(char.charCodeAt(0)) {
				case CharCode.NUM_0: case CharCode.NUM_1: case CharCode.NUM_2: case CharCode.NUM_3: case CharCode.NUM_4: case CharCode.NUM_5: case CharCode.NUM_6: case CharCode.NUM_7: case CharCode.NUM_8: case CharCode.NUM_9: case CharCode.U_LINE: case CharCode.MONEY: case CharCode.LOWER_A: case CharCode.LOWER_B: case CharCode.LOWER_C: case CharCode.LOWER_D: case CharCode.LOWER_E: case CharCode.LOWER_F: case CharCode.LOWER_G: case CharCode.LOWER_H: case CharCode.LOWER_I: case CharCode.LOWER_J: case CharCode.LOWER_K: case CharCode.LOWER_L: case CharCode.LOWER_M: case CharCode.LOWER_N: case CharCode.LOWER_O: case CharCode.LOWER_P: case CharCode.LOWER_Q: case CharCode.LOWER_R: case CharCode.LOWER_S: case CharCode.LOWER_T: case CharCode.LOWER_U: case CharCode.LOWER_V: case CharCode.LOWER_W: case CharCode.LOWER_X: case CharCode.LOWER_Y: case CharCode.LOWER_Z: case CharCode.UPPER_A: case CharCode.UPPER_B: case CharCode.UPPER_C: case CharCode.UPPER_D: case CharCode.UPPER_E: case CharCode.UPPER_F: case CharCode.UPPER_G: case CharCode.UPPER_H: case CharCode.UPPER_I: case CharCode.UPPER_J: case CharCode.UPPER_K: case CharCode.UPPER_L: case CharCode.UPPER_M: case CharCode.UPPER_N: case CharCode.UPPER_O: case CharCode.UPPER_P: case CharCode.UPPER_Q: case CharCode.UPPER_R: case CharCode.UPPER_S: case CharCode.UPPER_T: case CharCode.UPPER_U: case CharCode.UPPER_V: case CharCode.UPPER_W: case CharCode.UPPER_X: case CharCode.UPPER_Y: case CharCode.UPPER_Z:
					return true;
					break;
				default:
					return false;
					break;
			}
		}
		
		/*
		
		//numbers
		//------------------------------------------------------------------------------------------------
		
		//integer
		public static const INT	:RegExp = /^(\d)+$/;
		
		//number
		public static const NUM	:RegExp = /^((\d)+(\.)(\d)*)|((\.)(\d)+)$/;
		
		//------------------------------------------------------------------------------------------------
		//end of numbers
		
		
		//booleans
		//------------------------------------------------------------------------------------------------
		
		//true
		public static const TRUE	:RegExp = /^true$/;
		
		//false
		public static const FALSE	:RegExp = /^false$/;
		
		//------------------------------------------------------------------------------------------------
		//end of booleans
		
		
		//identifier
		//------------------------------------------------------------------------------------------------
		
		public static const IDENTIFIER	:RegExp = /^[_a-zA-Z$$][_a-zA-Z$$0-9]$/;
		
		//------------------------------------------------------------------------------------------------
		//end of identifier
		
		
		//keywords
		//------------------------------------------------------------------------------------------------
		
		//public static const KEYWORD	:RegExp;
		
		//------------------------------------------------------------------------------------------------
		//end of keywords
		
		*/
	}
}